
package andre.grids.db;

import andre.grids.db.dataclasses.*;
import com.db4o.*;
import com.db4o.query.*;
import java.util.*;

/**
 *
 * @author andre
 */
public class DbLogEntryQueries extends DbQueries<DbLogEntry> {
    public DbLogEntry[] getEntries(int year, int dayOfYear, int hour, int minute, int second, boolean dirLog) {
        DbLogEntry entry = DbLogEntry.getTemplate(year, dayOfYear, hour, minute, second, dirLog);
        
        
        ObjectSet<DbLogEntry> entries = super.getObjectListByPrototype(entry);
        
        //ObjectSet<DbLogEntry> entries = super.getObjectListByPrototype(new DbLogEntry());
        
        if (entries == null || entries.size() == 0)
            return null;
        DbLogEntry[] result = new DbLogEntry[entries.size()];
        Iterator<DbLogEntry> it = entries.iterator();
        int x =0;
        for(;it.hasNext();)
            result[x++] = it.next();
        return result;
    }
}
